package com.ibeeking.found.common.enums;

import com.ibeeking.nematos.exception.BusinessException;

/**
 * @Author ibeeking
 * @Date: 2019-04-26 16:04
 * @Description:
 */
public enum YesOrNoEnum {
    /**
     * 是
     */
    YES(1, "是"),

    /**
     * 否
     */
    NO(0, "否"),;

    private Integer value;
    private String name;

    YesOrNoEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getName(Integer value) {
        for (YesOrNoEnum ele : values()) {
            if (ele.getValue().equals(value)) {
                return ele.getName();
            }
        }
        return NO.getName();
    }
}
